1. Identification of Copyright
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
2. The Field of the Invention
The present invention relates generally to computer-implemented database systems. More specifically, the present invention relates to a system and method for filtering explain tables according to user-defined filters.
3. The Relevant Technology
Databases are computerized information storage and retrieval systems. A Relational Database Management System (RDBMS) is a database system which uses relational techniques for storing and retrieving data. Relational databases are organized into tables consisting of rows (tuples) and columns of data. A database typically includes many tables, and each table includes multiple rows and columns. The tables are conventionally stored in direct access storage devices (DASD), such as magnetic or optical disk drives, for semi-permanent storage.
Generally, users communicate with an RDBMS using a Structured Query Language (SQL) interface. The SQL interface allows users to create, manipulate, and query a database by formulating relational operations on the tables, either interactively, in batch files, or embedded in host languages such as C and COBOL. SQL has evolved into a standard language for RDBMS software and has been adopted as such by both the American National Standards Institute (ANSI) and the International Standards Organization (ISO).
The SQL standard provides that each RDBMS should respond to a particular query in the same way, regardless of the underlying database. However, the method that the RDBMS actually uses to find the requested information in the database is left to the RDBMS. Typically, there is more than one method that can be used by the RDBMS to access the requested data. The RDBMS, therefore, attempts to select the method that minimizes the computer time and resources (i.e. cost) for executing the query.
The RDBMS determines how to execute the SQL statements. The set of steps created by the RDBMS for executing the SQL statements is commonly referred to as the xe2x80x9caccess path.xe2x80x9d In other words, the access path is a sequence of operations used by the RDBMS to obtain the data requested by the SQL query. Depending on the access path, an SQL statement might search an entire table space, or, alternatively, it might use an index. The access path is the key to determining how well an SQL statement performs. The description of the access path is stored in a plan table, which typically stores the access path data for a plurality of SQL statements.
In addition to determining the access path, many databases estimate the cost (in time or service units) for executing each SQL statement. Typically, the estimated costs are stored in a statement table (in the case of DB2(copyright) for OS/390(copyright)) or another similar table in the database. Like the plan table, the statement table generally stores the estimated statement costs for a plurality of SQL statements.
Moreover, some databases store information relating to user-defined functions in a function table. User-defined functions can be very useful in developing database applications. Accordingly, it is advantageous to have information relating to the user-defined functions in a single, convenient location.
Collectively, the above-described access path data statement cost data, and function data are referred to as xe2x80x9cexplainxe2x80x9d data. The plan table, statement table, and function table are often called xe2x80x9cexplain tables.xe2x80x9d As noted above, the explain data is typically generated at bind time. However, the explain data can also be generated dynamically in response to a user-supplied query statement.
Unfortunately, because of the volume of data in the explain tables, users interested in improving SQL query performance often find the process of analyzing the explain tables difficult and time consuming. For example, it is typically difficult for a user to find the rows in the explain tables that are related to specific statements, functions, applications, and the like. To locate and view the desired rows, the user is typically required to formulate complex SQL queries, which requires a detailed knowledge of the underlying database.
Accordingly, what is needed is a system, method, and article of manufacture for filtering explain tables according to user-defined filters. What is also needed is a system, method, and article of manufacture for generating filters based on user-specified filtering criteria directed to one or more columns of the explain tables. Moreover, what is needed is a system, method, and article of manufacture for specifying filtering criteria in a simple and intuitive manner without the need for formulating complex SQL queries. Additionally, what is needed is a system, method, and article of manufacture for selectively storing and retrieving the user-defined filters.
The present invention solves the foregoing problems by providing a system, method, and article of manufacture for filtering explain tables according to user-defined filters. In one aspect of the invention, an apparatus for filtering an explain table includes a processor for executing instructions and a memory device having thereon modules of operational data and executable code for execution by the processor. In one embodiment, the modules include a filter generation module configured to receive user-specified filtering criteria directed to data within a selected column of the explain table and generate in response a user-defined filter. In one embodiment, the modules also include a table filtering module configured to apply the user-defined filter to the explain table to selectively exclude rows of the explain table not satisfying the filtering criteria of the user-defined filter.
In another aspect of the invention, a method for filtering an explain table comprising rows and columns includes the step of receiving user-specified filtering criteria directed to at least one column of the explain table and generating in response a user-defined filter. In one embodiment, the method also includes the step of applying the user-defined filter to the explain table to selectively exclude rows of the explain table not satisfying the filtering criteria of the user-defined filter.
In yet another aspect of the invention, an article of manufacture comprises a program storage medium readable by a processor and embodying one or more instructions executable by the processor to perform the above-described method for for filtering an explain table comprising rows and columns according to least one user-defined filter.
These and other objects, features, and advantages of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth in the following specification.